import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
const routes: Array<RouteRecordRaw> = [
    // 将匹配所有内容并将其放在 `$route.params.pathMatch` 下
    {
        path: "/:pathMatch(.*)*",
        name: "NotFound",
        component: () => import("~src/pages/notfound/index.vue"),
    },
    // 将匹配以 `/user-` 开头的所有内容，并将其放在 `$route.params.afterUser` 下
    // { path: "/user-:afterUser(.*)", component: UserGeneric },
    {
        path: "/",
        name: "root",
        component: () => import("~src/pages/index/index.vue"),
        meta: { transition: 'slide-left' },
    },
    {
        path: "/index",
        name: "index",
        component: () => import("~src/pages/index/index.vue"),
        meta: { transition: 'slide-left' },
    },
    {
        path: "/about",
        name: "About",
        component: () => import("~src/pages/about/index.vue"),
        meta: { transition: 'slide-left' },
    },

    {
        path: "/web",
        name: "webIndex",
        component: () => import("~src/pages/web/index.vue"),
        meta: { transition: 'slide-left' },
        children: [
            {
                path: "/web/pinia",
                name: "pinia",
                component: () => import("~src/pages/web/pinia/index.vue"),
                meta: { transition: 'slide-left' },
            },
            {
                path: "/web/echats",
                name: "echats",
                component: () => import("~src/pages/web/echats/index.vue"),
                meta: { transition: 'slide-left' },
            },
            {
                path: "/web/lottie",
                name: "lottie",
                component: () => import("~src/pages/web/lottie/index.vue"),
                meta: { transition: 'slide-left' },
            }
        ]

    },
    {
        path: "/ui",
        name: "uiIndex",
        component: () => import("~src/pages/ui/index.vue"),
        meta: { transition: 'slide-left' },
        children: [
            {
                path: "/ui/material",
                name: "uimaterial",
                component: () => import("~src/pages/ui/material/index.vue"),
                meta: { transition: 'slide-left' },
            },
            // {
            //     path: "/ui/color",
            //     name: "uicolor",
            //     component: () => import("~src/pages/ui/color/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/inspiration",
            //     name: "uiinspiration",
            //     component: () => import("~src/pages/ui/inspiration/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/designSize",
            //     name: "uidesignSize",
            //     component: () => import("~src/pages/ui/designSize/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/icon",
            //     name: "uiicon",
            //     component: () => import("~src/pages/ui/icon/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/formwork",
            //     name: "uiformwork",
            //     component: () => import("~src/pages/ui/formwork/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/admin",
            //     name: "uiadmin",
            //     component: () => import("~src/pages/ui/admin/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },
            // {
            //     path: "/ui/collaborationTools",
            //     name: "uicollaborationTools",
            //     component: () => import("~src/pages/ui/collaborationTools/index.vue"),
            //     meta: { transition: 'slide-left' },
            // },

        ]

    },
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});
//全局前置路由守卫————初始化的时候被调用、每次路由切换之前被调用
// router.beforeEach((to, from, next) => {
//   console.log("前置路由守卫", to, from);
// });

// //全局后置路由守卫————初始化的时候被调用、每次路由切换之后被调用
// router.afterEach((to, from) => {
//   console.log("后置路由守卫", to, from);
// });

export default router;
